#include <QFile>
#include <QFileInfo>
#include <QTextStream>
#include "aisdocdatasource.h"

AISDocDataSource::AISDocDataSource(QObject *parent) :
    QObject(parent)
{
}

bool AISDocDataSource::loadFile(const QString &filePath)
{
    curFile = new QFile(filePath);
    if (! curFile->open(QFile::ReadWrite | QFile::Text))
    {
        curFile = NULL;
        return false;
    }

    return true;
}

QString AISDocDataSource::readFile(qint64 startOffset, qint64 length)
{
    if (NULL != curFile)
    {
        QTextStream inStream(curFile);
        return inStream.readAll();
    }

    return NULL;
}
